home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
-
- Created: Friday, June 4, 1993 at 10:05AM
- OCEStandardDirectory.h
- C Interface to the Macintosh Libraries
-
- Copyright Apple Computer, Inc. 1990-1993
- All rights reserved
-
- ************************************************************/
-
-
- #ifndef __OCESTANDARDDIRECTORY__
- #define __OCESTANDARDDIRECTORY__
-
- #ifndef REZ
-
- #ifndef __OCE__
- #include <OCE.h>
- #endif
-
- #ifndef __OCEAUTHDIR__
- #include <OCEAuthDir.h>
- #endif
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
- #ifndef __ICONS__
- #include <Icons.h>
- #endif
-
-
-
- /* Macros used for generating Inline Code. */
-
- #ifndef __SDPPanel
- #define __SDPPanel(count,selector) = { 0x203C,count,selector, 0xAA5D}
- #endif
-
- #ifndef __SDPPrompt
- #define __SDPPrompt(count,selector) = { 0x203C,count,selector, 0xAA5D}
- #endif
-
- #ifndef __FindPanel
- #define __FindPanel(count,selector) = { 0x203C,count,selector, 0xAA5D}
- #endif
-
- #ifndef __SDPUtils
- #define __SDPUtils(selector) = { 0x303C, selector, 0xAA5C}
- #endif
-
- #ifndef __SDPAlias
- #define __SDPAlias(count,selector) = { 0x203C,count,selector, 0xAA5D}
- #endif
-
- #ifndef __SDPPDUtils
- #define __SDPPDUtils(count,selector) = {0x203c,count,selector,0xAA5D}
- #endif
-
- /* CollabPack Trap Selectors */
-
- #define kSDPNewPanel 100
- #define kSDPGetNewPanel 101
- #define kSDPDisposePanel 102
- #define kSDPHidePanel 103
- #define kSDPShowPanel 104
- #define kSDPEnablePanel 105
- #define kSDPUpdatePanel 106
- #define kSDPMovePanel 107
- #define kSDPSizePanel 108
- #define kSDPOpenSelectedItem 109
- #define kSDPGetPanelSelectionState 110
- #define kSDPGetPanelSelection 111
- #define kSDPSetPath 112
- #define kSDPPanelEvent 113
- #define kSDPGetPanelSelectionSize 114
- #define kSDPSetIdentity 115
- #define kSDPSelectString 116
- #define kSDPGetPathLength 117
- #define kSDPGetPath 118
- #define kSDPSetFocus 119
- #define kSDPSetPanelBalloonHelp 120
- #define kSDPInstallPanelBusyProc 121
-
- #define kSDPPromptForID 904
-
- #define kSDPNewFindPanel 2300
- #define kSDPDisposeFindPanel 2301
- #define kSDPStartFind 2302
- #define kSDPStopFind 2303
- #define kSDPFindPanelEvent 2304
- #define kSDPDrawFindPanel 2305
- #define kSDPShowFindPanel 2306
- #define kSDPHideFindPanel 2307
- #define kSDPMoveFindPanel 2308
- #define kSDPEnableFindPanel 2309
- #define kSDPSetFindPanelFocus 2310
- #define kSDPGetFindPanelState 2311
- #define kSDPGetFindPanelSelectionSize 2312
- #define kSDPGetFindPanelSelection 2313
- #define kSDPSetFindPanelBalloonHelp 2314
- #define kSDPSetFindIdentity 2315
- #define kSDPInstallFindPanelBusyProc 2316
-
- #define kSDPGetIconByType 1024
- #define kSDPGetDSSpecIcon 1025
- #define kSDPGetCategories 1026
- #define kSDPGetCategoryTypes 1027
-
- #define kSDPResolveAliasFile 3700
- #define kSDPResolveAliasDSSpec 3701
-
- #define kSDPRepairPersonalDirectory 6700
-
- /* Collaboration Package Gestalts. */
-
- #define gestaltSDPStandardDirectoryVersion 'sdvr'
- #define gestaltSDPFindVersion 'dfnd'
- #define gestaltSDPPromptVersion 'prpv'
-
-
-
- #ifndef svLarge1Bit
- /* Selector mask values */
- /* This is temporary. It will eventually appear in Icons.h */
- typedef unsigned long IconSelectorValue;
- #define svLarge1Bit 0x00000001
- #define svLarge4Bit 0x00000002
- #define svLarge8Bit 0x00000004
- #define svSmall1Bit 0x00000100
- #define svSmall4Bit 0x00000200
- #define svSmall8Bit 0x00000400
- #define svMini1Bit 0x00010000
- #define svMini4Bit 0x00020000
- #define svMini8Bit 0x00040000
- #define svAllLargeData 0x000000ff
- #define svAllSmallData 0x0000ff00
- #define svAllMiniData 0x00ff0000
- #define svAll1BitData (svLarge1Bit | svSmall1Bit | svMini1Bit)
- #define svAll4BitData (svLarge4Bit | svSmall4Bit | svMini4Bit)
- #define svAll8BitData (svLarge8Bit | svSmall8Bit | svMini8Bit)
- #define svAllAvailableData 0xffffffff
- #endif
-
- #endif /* REZ */
-
- /* generic icon suites */
-
- #define genericDirectoryIconResource -16721 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
- #define genericLockedDirectoryIconResource -16716 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
- #define genericRecordIconResource -16722 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
- #define genericAttributeIconResource -16723 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
- #define genericTemplateIconResource -16746 /* icl8, icl4, ICN#, ics#, ics4, ics8 */
-
-
-
- /* standard icon suites */
-
- #define directoryFolderIconResource -16720 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
- #define lockedDirectoryFolderIconResource -16719 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
- #define personalDirectoryIconResource -16718 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
- #define directoriesIconResource -16717 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
- #define preferredPersonalDirectoryIconResource -16724 /* icl8, icl4, ICN#, ics#, ics4, ics8, sicn */
-
- /* icon IDs for spinning arrows */
- #define kFirstSpinnerIcon -16745
- #define kLastSpinnerIcon -16738
-
-
- /* resource types */
- #define kSDPPanelResourceType 'panl'
- #define kSDPFindPanelResourceType 'find'
-
- /* Standard FindPanel resource */
- #define kStandardFindLayout -16700
-
-
- #ifndef REZ
-
-
- /* Prompt For Identity structures */
-
- enum {
- kSDPGuestBit,
- kSDPSpecificIdentityBit,
- kSDPLocalIdentityBit
- };
-
- /* Values of SDPIdentityKind */
- enum {
- kSDPGuestMask = 1<<kSDPGuestBit,
- kSDPSpecificIdentityMask = 1<<kSDPSpecificIdentityBit,
- kSDPLocalIdentityMask = 1<<kSDPLocalIdentityBit
- };
-
- typedef unsigned short SDPIdentityKind;
-
-
- enum {
- kSDPSuggestionOnly,
- kSDPRestrictToDirectory,
- kSDPRestrictToRecord
- };
-
- typedef unsigned short SDPLoginFilterKind;
-
-
-
-
- /* Panel Structures */
-
- /*
- While the panel is in operation, four selection states may exist.
- 1) kSDPNothingSelected means nothing is selected.
- 2) kContainSelected means a volume, folder, catalog, dnode, or PAB is selected.
- 3) kSDPLockedContainerSelected means one of the above, but no access privledges.
- 4) kSDPRecordSelected means that a record is currently selected.
- */
-
- /* Values of SDPSelectionState */
- enum {
- kSDPNothingSelected,
- kSDPLockedContainerSelected,
- kSDPContainerSelected,
- kSDPRecordSelected,
- kSDPRecordAliasSelected,
- kSDPContainerAliasSelected
- };
-
- typedef unsigned short SDPSelectionState;
-
-
-
-
- /*
- This type informs the caller of the action the user took, either as the result
- of an event (as returned by SDPPanelEvent) or when SDPOpenSelectedItem is called.
-
- kSDPProcessed means that the event (or call to SDPOpenSelectedItem) resulted in no
- state change.
-
- kSDPSelectedAnItem indicates that the user wants to select the currently-hilited
- record. This is returned, for example, when a user double-clicks on a record.
-
- kSDPChangedSelection implies that the user clicked on a new item (which may mean
- that no item is selected).
- */
-
- /* Values of SDPPanelState */
- enum {
- kSDPProcessed,
- kSDPSelectedAnItem,
- kSDPChangedSelection
- };
-
- typedef unsigned short SDPPanelState;
-
-
- /*
- Your application may read any of the fields in a SDPPanelRecord, but it should
- use the appropriate routines to make changes to the records with the exception
- of the refCon field which your application may read or write at will. Private
- information follows the SDPPanelRecord, so the handle must not be re-sized.
- */
-
- struct SDPPanelRecord {
- Rect bounds;
- Boolean visible;
- Boolean enabled;
- Boolean focused;
- Byte padByte;
- AuthIdentity identity;
- long refCon;
- Rect listRect;
- Rect popupRect;
- short numberOfRows;
- short rowHeight;
- Boolean pabMode;
- };
-
- typedef struct SDPPanelRecord SDPPanelRecord;
-
- typedef SDPPanelRecord *SDPPanelPtr, **SDPPanelHandle;
-
-
-
- typedef pascal void (*PanelBusyProc) (SDPPanelHandle Panel, Boolean busy);
-
-
-
-
- /* Find Panel Structures */
-
- enum {
- kSDPItemIsSelectedBit,
- kSDPFindTextExistsBit
- };
-
- /* Values of SDPFindPanelState */
- enum {
- kSDPItemIsSelectedMask = 1<<kSDPItemIsSelectedBit,
- kSDPFindTextExistsMask = 1<<kSDPFindTextExistsBit
- };
-
- typedef unsigned short SDPFindPanelState;
-
-
- /* Values of SDPFindPanelFocus */
- enum {
- kSDPFindPanelNoFocus,
- kSDPFindPanelListHasFocus,
- kSDPFindPanelTextHasFocus
- };
-
- typedef unsigned short SDPFindPanelFocus;
-
-
-
-
- struct SDPFindPanelRecord {
- Point upperLeft;
- Boolean visible;
- Boolean enabled;
- Boolean nowFinding;
- Byte padByte;
- SDPFindPanelFocus currentFocus;
- AuthIdentity identity;
- short simultaneousSearchCount;
- long refCon;
- };
-
- typedef struct SDPFindPanelRecord SDPFindPanelRecord;
-
- typedef SDPFindPanelRecord *SDPFindPanelPtr, **SDPFindPanelHandle;
-
-
- /* Values of SDPFindPanelResult */
- enum {
- kSDPSelectedAFindItem,
- kSDPFindSelectionChanged,
- kSDPFindCompleted,
- kSDPTextStateChanged,
- kSDPFocusChanged,
- kSDPSelectionAndFocusChanged,
- kSDPMenuChanged,
- kSDPSelectionAndMenuChanged,
- kSDPProcessedFind
- };
-
- typedef unsigned short SDPFindPanelResult;
-
-
- typedef PackedPathNamePtr *PackedRStringListHandle;
-
- typedef PackedDSSpec **PackedDSSpecHandle;
-
- typedef pascal void (*FindPanelBusyProc) (SDPFindPanelHandle findPanel, Boolean busy);
-
- /* Prompt For Identity Routines */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- pascal OSErr SDPPromptForID(AuthIdentity *id,
- ConstStr255Param guestPrompt,
- ConstStr255Param specificIDPrompt,
- ConstStr255Param localIDPrompt,
- const RString *recordType,
- SDPIdentityKind permittedKinds,
- SDPIdentityKind *selectedKind,
- const RecordID *loginFilter,
- SDPLoginFilterKind filterKind)
- __SDPPrompt(16,kSDPPromptForID);
-
-
-
- /*
- SDPNewPanel creates a new panel. You supply the window in which the panel
- is to live, the bounds for the panel (which includes both the menu and the list),
- whether or not the panel is to be initially visible, the initial RLI (nil for
- catalogs and volumes), the types of records that will be shown (only a single
- (non-nil) type which may contain wildcards), the identity by which to browse
- (for access control reasons), and a refCon which is available to the caller.
- */
- pascal OSErr SDPNewPanel(SDPPanelHandle *newPanel,
- WindowPtr window,
- const Rect* bounds,
- Boolean visible,
- Boolean enabled,
- const PackedRLI *initialRLI,
- const RStringPtr* typesList,
- unsigned long typeCount,
- AuthIdentity identity,
- DirEnumChoices enumFlags,
- DirMatchWith matchTypeHow,
- long refCon)
- __SDPPanel(21,kSDPNewPanel);
-
-
- /*
- SDPSetIdentity Sets the identity used for browsing.
- */
- pascal OSErr SDPSetIdentity(SDPPanelHandle panel, AuthIdentity identity)
- __SDPPanel(4,kSDPSetIdentity);
-
-
-
-
- /*
- SDPGetNewPanel is similar to SDPNewPanel above, except it takes a resource id of a
- 'panl' resource.
- */
- pascal OSErr SDPGetNewPanel(SDPPanelHandle *newPanel,
- short resourceID,
- WindowPtr window,
- const PackedRLI *initialRLI,
- AuthIdentity identity)
- __SDPPanel(9,kSDPGetNewPanel);
-
-
- /*
- Call this when you're completely done with a panel. It deallocates all of the
- associated data structures.
- */
- pascal OSErr SDPDisposePanel(SDPPanelHandle panel)
- __SDPPanel(2,kSDPDisposePanel);
-
-
- /*
- If the panel is visible, it makes it invisible by hiding the menu, turning off
- drawing of the list, and erasing and invaling the list's rectangle.
- */
- pascal OSErr SDPHidePanel(SDPPanelHandle panel)
- __SDPPanel(2,kSDPHidePanel);
-
-
- /* If the panel is invisible, it makes it visible and draws it. */
-
- pascal OSErr SDPShowPanel(SDPPanelHandle panel)
- __SDPPanel(2,kSDPShowPanel);
-
-
- /* Disables the list and menu so that it won't accept any commands. */
-
- pascal OSErr SDPEnablePanel(SDPPanelHandle panel, Boolean enable)
- __SDPPanel(3,kSDPEnablePanel);
-
- /*
- Move the upper-left-hand corner of the panel to (h,v), given in local coordinates of
- the panel's window.
- */
- pascal OSErr SDPMovePanel(SDPPanelHandle panel, short h, short v)
- __SDPPanel(4,kSDPMovePanel);
-
-
- /*
- Resizes the panel to have the given width and height (keeping the upper-left-hand
- corner in a fixed position).
- */
- pascal OSErr SDPSizePanel(SDPPanelHandle panel, short width, short height)
- __SDPPanel(4,kSDPSizePanel);
-
-
- /*
- This routine simulates a double-click on the selected item (if there is no selected
- item, then it does nothing), and it returns the result of that "double-click" via the
- whatHappened parameter. If a container is selected, then that container will be
- opened and kMovedDownTheHierarchy is returned. If, however, the user is at the lowest
- level in the hierarchy, then kSDPSelectedAnItem is returned.
- */
- pascal OSErr SDPOpenSelectedItem(SDPPanelHandle panel, SDPPanelState *whatHappened)
- __SDPPanel(4,kSDPOpenSelectedItem);
-
-
- /*
- Returns whether a record is selected, something else is selected, or nothing is
- selected.
- */
- pascal OSErr SDPGetPanelSelectionState(SDPPanelHandle panel, SDPSelectionState *itsState)
- __SDPPanel(4,kSDPGetPanelSelectionState);
-
-
- /*
- Returns the size of the currently-selected DSSpec, or zero if a record is
- not selected. It is safe to do a NewPtr (SDPGetPanelSelectionSize (...))
- */
- pascal OSErr SDPGetPanelSelectionSize(SDPPanelHandle panel, unsigned short *dsSpecSize)
- __SDPPanel(4,kSDPGetPanelSelectionSize);
-
-
- /*
- Returns the currently-selected DSSpec, or a zero-lengthed
- DSSpec if a record is not selected. It is assumed that the selection
- buffer allocated is large enough.
- */
- pascal OSErr SDPGetPanelSelection(SDPPanelHandle panel, PackedDSSpec *selection)
- __SDPPanel(4,kSDPGetPanelSelection);
-
-
- /*
- Forces browsing to the specified RLI. If prli is the current RLI, then it does
- nothing.
- */
- pascal OSErr SDPSetPath(SDPPanelHandle panel, const PackedRLI *prli)
- __SDPPanel(4,kSDPSetPath);
-
-
- /*
- This is the main driver for the panel. You should pass all events to SDPPanelEvent
- including NULL events. If you have more than 1 panel, you will need to
- call SDPPanelEvent for each panel. NOTE: For Update Events you will also need to call
- SDPUpdatePanel as described below.
- */
- pascal OSErr SDPPanelEvent(SDPPanelHandle panel,
- const EventRecord *theEvent,
- SDPPanelState *whatHappened)
- __SDPPanel(6,kSDPPanelEvent);
-
-
-
- /*
- SDPUpdatePanel should be called in response to an update event. Generally you will
- have first called BeginUpdate, and pass the windows visRgn as theRgn. If NULL
- is passed for theRgn the entire panel is re-drawn. NOTE: Drawing is not cliped to
- theRgn, if this is desired, you must first call SetClip.
- */
- pascal OSErr SDPUpdatePanel(SDPPanelHandle panel, RgnHandle theRgn)
- __SDPPanel(4,kSDPUpdatePanel);
-
-
- /*
- SDPSelectString scrolls and selects the closest matching string at the current
- level. This is the same behavior as if the user typed in the given string.
- */
- pascal OSErr SDPSelectString(SDPPanelHandle panel, const RString* name)
- __SDPPanel(4,kSDPSelectString);
-
- /*
- SDPGetPathLength returns the length in bytes required to hold the current path name
- in RLI format. This corresponds to the path name in the popup menu.
- */
- pascal OSErr SDPGetPathLength(SDPPanelHandle panel, unsigned short *pathNameLength)
- __SDPPanel(4,kSDPGetPathLength);
-
- /* SDPGetPath returns the current rli. */
- pascal OSErr SDPGetPath(SDPPanelHandle panel, PackedRLI *prli,short *dsRefNum)
- __SDPPanel(6,kSDPGetPath);
-
- /*
- SDPSetFocus will draw the focus rectangle or erase the focus rectangle depending upon
- the focus boolean.
- */
- pascal OSErr SDPSetFocus(SDPPanelHandle panel, Boolean focus)
- __SDPPanel(3,kSDPSetFocus);
-
- /*
- SDPSetPanelBalloonHelp allows clients to specify a STR# resource id to use for
- balloon help. Balloon help is unavailable until this call is made.
- */
- pascal OSErr SDPSetPanelBalloonHelp(SDPPanelHandle panel, short balloonHelpID)
- __SDPPanel(3,kSDPSetPanelBalloonHelp);
-
- /*
- SDPInstallPanelBusyProc allows clients to install a CB that will be called while
- the panel is aynchronously busy.
- */
- pascal OSErr SDPInstallPanelBusyProc(SDPPanelHandle panel, PanelBusyProc busyProc)
- __SDPPanel(4, kSDPInstallPanelBusyProc);
-
-
- pascal OSErr SDPNewFindPanel(SDPFindPanelHandle *newPanel, WindowPtr window,
- Point upperLeft, short layoutResourceID, Boolean visible,
- Boolean enabled, const RStringPtr* typesList, long typeCount,
- DirMatchWith matchTypeHow, AuthIdentity identity, short simultaneousSearchCount,
- SDPFindPanelFocus initialFocus, long refCon)
- __FindPanel(20, kSDPNewFindPanel);
-
- pascal OSErr SDPDisposeFindPanel(SDPFindPanelHandle findPanel)
- __FindPanel(2, kSDPDisposeFindPanel);
-
- pascal OSErr SDPStartFind(SDPFindPanelHandle findPanel)
- __FindPanel(2, kSDPStartFind);
-
- pascal OSErr SDPStopFind(SDPFindPanelHandle findPanel)
- __FindPanel(2, kSDPStopFind);
-
- pascal OSErr SDPFindPanelEvent(SDPFindPanelHandle findPanel,
- const EventRecord *event, SDPFindPanelResult *whatHappened)
- __FindPanel(6, kSDPFindPanelEvent);
-
- pascal OSErr SDPUpdateFindPanel(SDPFindPanelHandle findPanel, RgnHandle theRgn)
- __FindPanel(4, kSDPDrawFindPanel);
-
- pascal OSErr SDPShowFindPanel(SDPFindPanelHandle findPanel)
- __FindPanel(2, kSDPShowFindPanel);
-
- pascal OSErr SDPHideFindPanel(SDPFindPanelHandle findPanel)
- __FindPanel(2, kSDPHideFindPanel);
-
- pascal OSErr SDPMoveFindPanel(SDPFindPanelHandle findPanel, short h, short v)
- __FindPanel(4, kSDPMoveFindPanel);
-
- pascal OSErr SDPEnableFindPanel(SDPFindPanelHandle findPanel, Boolean enabled)
- __FindPanel(3, kSDPEnableFindPanel);
-
- pascal OSErr SDPSetFindPanelFocus(SDPFindPanelHandle findPanel,
- SDPFindPanelFocus newFocus)
- __FindPanel(3, kSDPSetFindPanelFocus);
-
- pascal OSErr SDPGetFindPanelState(SDPFindPanelHandle findPanel, SDPFindPanelState* itsState)
- __FindPanel(4, kSDPGetFindPanelState);
-
- pascal OSErr SDPGetFindPanelSelectionSize(SDPFindPanelHandle findPanel,
- unsigned short *size)
- __FindPanel(4, kSDPGetFindPanelSelectionSize);
-
- pascal OSErr SDPGetFindPanelSelection(SDPFindPanelHandle findPanel,
- PackedDSSpec* selection)
- __FindPanel(4, kSDPGetFindPanelSelection);
-
- pascal OSErr SDPSetFindPanelBalloonHelp(SDPFindPanelHandle findPanel,
- short balloonHelpID)
- __FindPanel(3, kSDPSetFindPanelBalloonHelp);
-
- pascal OSErr SDPSetFindIdentity(SDPFindPanelHandle findPanel,
- AuthIdentity identity)
- __FindPanel(4, kSDPSetFindIdentity);
-
- pascal OSErr SDPInstallFindPanelBusyProc(SDPFindPanelHandle findPanel, FindPanelBusyProc busyProc)
- __FindPanel(4, kSDPInstallFindPanelBusyProc);
-
-
-
- pascal OSErr SDPGetIconByType(const RString* recordType,
- IconSelectorValue whichIcons,
- Handle* iconSuite)
- __SDPUtils(kSDPGetIconByType);
-
- pascal OSErr SDPGetDSSpecIcon(const PackedDSSpec* packedDSSpec,
- IconSelectorValue whichIcons,
- Handle* iconSuite)
- __SDPUtils(kSDPGetDSSpecIcon);
-
- pascal OSErr SDPGetCategories(PackedRStringListHandle* categories,
- PackedRStringListHandle* displayNames)
- __SDPUtils(kSDPGetCategories);
-
- pascal OSErr SDPGetCategoryTypes(const RString* category,
- PackedRStringListHandle* types)
- __SDPUtils(kSDPGetCategoryTypes);
-
-
-
-
- pascal OSErr SDPResolveAliasFile(FSSpecPtr fileSpec,
- PackedDSSpecHandle resolvedDSSpec,
- AuthIdentity identity,
- Boolean mayPromptUser)
- __SDPAlias(7, kSDPResolveAliasFile);
-
- pascal OSErr SDPResolveAliasDSSpec(PackedDSSpecHandle theAliasDSSpec,
- AuthIdentity identity,
- Boolean mayPromptUser)
- __SDPAlias(5, kSDPResolveAliasDSSpec);
-
- pascal OSErr SDPRepairPersonalDirectory(FSSpec *pd, Boolean showProgress)
- __SDPPDUtils(3, kSDPRepairPersonalDirectory);
-
- #ifdef __cplusplus
- };
- #endif
-
-
-
-
- #endif /* REZ */
-
- #endif /* __OCESTANDARDDIRECTORY__ */
-